package com.study.zouchao.superproject.comtaskdetail.model;

import com.study.zouchao.superproject.base_zou.api_zou.Api_C;
import com.study.zouchao.superproject.travellist.entity.TravelListResult;
import com.study.zouchao.superproject.util.RxSchedulers;
import com.study.zouchao.superproject.util.api.api.Api;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import rx.Observable;

/**
 * Created by Administrator on 2017/6/20.
 */

public class TaskDetailModel {

    /*
     *  真正的接口
     * @param params
     * @return
     */
    public Observable<TaskDetailResult> connTaskDetail(Map<String, String> params) {
        return Api.getInstance(Api_C.BASE_URL_LIN_BASE).mApiService
                .getTaskDetail(params)
//                .map(RxSchedulers.<TravelListResult>sleep(3000))
                .compose(RxSchedulers.<TaskDetailResult>io_main());
    }

    public Observable<IsEnrolledResult> connIsEnrolled(Map<String, String> params) {
        return Api.getInstance(Api_C.BASE_URL_LIN_BASE).mApiService
                .isEnrolledByPOST(params)
//                .map(RxSchedulers.<TravelListResult>sleep(3000))
                .compose(RxSchedulers.<IsEnrolledResult>io_main());
    }


    public Observable<EnrollResult> connEnrollNow(Map<String, String> params) {
        return Api.getInstance(Api_C.BASE_URL_LIN_BASE).mApiService
                .enrollNowByPOST(params)
//                .map(RxSchedulers.<TravelListResult>sleep(3000))
                .compose(RxSchedulers.<EnrollResult>io_main());
    }


//    public Observable<TaskDetailResult> connTaskDetail(Map<String, String> params) {
//        return Observable.just(getTestData())
//                .compose(RxSchedulers.<TaskDetailResult>io_main());
//    }

//    private TaskDetailResult getTestData() {
//        TaskDetailResult.TaskDetailDataBean.EnrolledListBean  enrolledListBean1 = new TaskDetailResult.TaskDetailDataBean.EnrolledListBean(10086, "邹超", "https://ss2.baidu.com/6ONYsjip0QIZ8tyhnq/it/u=1508147321,286322940&fm=58");
//        TaskDetailResult.TaskDetailDataBean.EnrolledListBean  enrolledListBean2 = new TaskDetailResult.TaskDetailDataBean.EnrolledListBean(10086, "邹超", "https://ss2.baidu.com/6ONYsjip0QIZ8tyhnq/it/u=1508147321,286322940&fm=58");
//        TaskDetailResult.TaskDetailDataBean.EnrolledListBean  enrolledListBean3 = new TaskDetailResult.TaskDetailDataBean.EnrolledListBean(10086, "邹超", "https://ss2.baidu.com/6ONYsjip0QIZ8tyhnq/it/u=1508147321,286322940&fm=58");
//        List<TaskDetailResult.TaskDetailDataBean.EnrolledListBean> enrolledList = new ArrayList<>();
//        enrolledList.add(enrolledListBean1);
//        enrolledList.add(enrolledListBean2);
//        enrolledList.add(enrolledListBean3);
//
//
//        TaskDetailResult.TaskDetailDataBean.TaskDetailBean  detailBean = new TaskDetailResult.TaskDetailDataBean.TaskDetailBean(18,
//                "http://static.yidianzixun.com//beauty//imgs//i_000ga3YZ.jpg", "zouchao", 80, "3个小时前", "reward啊阿!!!", "18359228397", 5, "求帮忙啊", "男", "9:00am - 10:am", "没什么可描述的");
//
//        TaskDetailResult.TaskDetailDataBean dataBean = new TaskDetailResult.TaskDetailDataBean(detailBean, enrolledList, 55, 1);
//
//        TaskDetailResult result = new TaskDetailResult(dataBean, 21301, "获取数据成功");
//        return result;
//    }
}
